Skip to content

go-avahi: Add initial fuzzing project with 4 comprehensive harnesses#49

Open
rishavtarway wants to merge 5 commits intoOpenPrinting:mainfrom
rishavtarway:add-go-avahi-support
Open

go-avahi: Add initial fuzzing project with 4 comprehensive harnesses#49
rishavtarway wants to merge 5 commits intoOpenPrinting:mainfrom
rishavtarway:add-go-avahi-support

Conversation

@rishavtarway
Copy link
Contributor

This PR adds the initial fuzzing infrastructure for the go-avahi project.

Changes:

  • Added projects/go-avahi/fuzzer/fuzz_domain.go: Harness to fuzz the DomainNormalize function targeting CGo boundary safety.
  • Added projects/go-avahi/fuzzer/fuzz_domain_roundtrip.go: Verifies round-trip consistency between DomainFrom and DomainSlice and identifies logic errors in unescaping.
  • Added projects/go-avahi/fuzzer/fuzz_service_name.go: Tests split/join consistency for mDNS service names ensuring stable parsing.
  • Added projects/go-avahi/fuzzer/fuzz_state_strings.go: Verifies stability of String methods for library states against arbitrary integer inputs.
  • Added projects/go-avahi/oss_fuzz_build.sh: Build script enabling CGo compilation and linking against required system libraries.
  • Added integrated seed corpora: Covering edge cases such as Unicode labels, escaped characters, and boundary values.

Testing:

  • Verified locally using OSS-Fuzz Docker images and the helper.py framework.
  • Validated build success with compile_native_go_fuzzer.
  • Confirmed high execution stability and compatibility with AddressSanitizer (ASAN).


func FuzzDomainRoundTrip(f *testing.F) {
// Seed corpus: representative domain name strings
f.Add("example.local")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f.Add() does not automatically populate seeds during fuzzing in OSS-Fuzz. you must provide a seed corpus as a .zip archive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


func FuzzServiceName(f *testing.F) {
// Seed corpus: realistic mDNS service names
f.Add("Kyocera ECOSYS M2040dn._ipp._tcp.local")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, f.Add() does not automatically populate seeds during fuzzing in OSS-Fuzz

Copy link
Contributor Author

@rishavtarway rishavtarway Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed f.Add() seeds for ZIP archives in oss_fuzz_build.sh, following the fuzzzing standard

func FuzzStateStrings(f *testing.F) {
// Seed corpus: boundary values
f.Add(int32(0))
f.Add(int32(1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here as well, f.Add() ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -1 +1 @@
#!/bin/bash -eu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you do not need a copyright header for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Removed the copyright header as suggested.

@rishavtarway rishavtarway requested a review from mdimado March 1, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants